package org.lonetree.tc.webapp.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class SectionForm extends ActionForm {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	//private String id;			//8
	//private String cid;			//4
	private String sec_num;		//002
	private String prof;		//Hasan Cavusoglu
	
	@Override
	public ActionErrors validate(ActionMapping mapping,	HttpServletRequest request) {

		 ActionErrors errors = new ActionErrors();
	        
		 if (sec_num == null)
	    	 errors.add("sec_num", new ActionMessage("adminindividualcourses.addsection.error.secnum"));
	     if (sec_num.length() != 3)
	    	 errors.add("sec_num_length", new ActionMessage("adminindividualcourses.addsection.error.secnumber.length"));	     
	     if (prof.length() < 1 || (prof == null))
	    	 errors.add("prof", new ActionMessage("adminindividualcourses.addsection.error.prof"));
	     
	     return errors;
	}

	public String getSec_num() {
		return sec_num;
	}

	public void setSec_num(String sec_num) {
		this.sec_num = sec_num;
	}

	public String getProf() {
		return prof;
	}

	public void setProf(String prof) {
		this.prof = prof;
	}
	
}
